module ScriptsHelper
  def commands_form_column(record, input_name)
    "<div class='textarea-holder'>"+text_area(:record, :commands, { :cols => 200, :rows => 80, :onkeydown => 'javascript:return insertTab(event, this);', :onkeyup => 'javascript:return insertTab(event, this);', :onkeypress => 'javascript:return insertTab(event, this);' })+"</div><p style='font-weight:bold; font-size:11px; font-family:arial; width:350px;'>You can use @mysqluser, @mysqlpassword and @mysqlhost to access the corresponding values you entered when you set up the server.</p>"
  end
  def commands_column(record)
    if caller.join =~ /show_column/
      "<pre style='width:640px; overflow:scroll;'>#{record.commands}</pre>"
    else
      intLength = 60
      record.commands.nil? ? "No command provided" : (record.commands.length > intLength ? record.commands[0..(intLength-1)]+' ...' : record.commands)
    end
  end
end
